import 'package:vista/shared/models/base_frame.dart';

/// 点赞画面
/// 存储点赞信息，如摄影中的画面般记录点赞瞬间
class LikeFrame extends BaseFrame {
  final String id; // 点赞ID
  final String postId; // 动态ID
  final String userId; // 用户ID
  final DateTime timestamp; // 点赞时间

  const LikeFrame({
    required this.id,
    required this.postId,
    required this.userId,
    required this.timestamp,
  });

  /// 从JSON创建点赞画面
  factory LikeFrame.fromJson(Map<String, dynamic> json) {
    return LikeFrame(
      id: json['id'] as String,
      postId: json['postId'] as String,
      userId: json['userId'] as String,
      timestamp: DateTime.parse(json['timestamp'] as String),
    );
  }

  @override
  List<Object?> get props => [id, postId, userId, timestamp];

  @override
  Map<String, dynamic> toJson() {
    return {
      'id': id,
      'postId': postId,
      'userId': userId,
      'timestamp': timestamp.toIso8601String(),
    };
  }
}
